import request from '@/utils/request'


// 1. 导出消息记录 (POST /system/basicMessage/export)
export function exportMessage(data) {
  return request({
    url: '/basic/system/basicMessage/export',
    method: 'post',  // 绿色背景POST方法
    data: data,
    responseType: 'blob',  // 处理二进制文件流
  })
}

// 2. 查询消息记录列表 (GET /system/basicMessage/list)
export function listMessage(params) {
  return request({
    url: '/basic/system/basicMessage/list',
    method: 'get',  // 蓝色背景GET方法
    params: params,
  })
}

// 3. 获取通道类型字典 (GET /system/basicMessage/getChannelTypeDictList)
export function getChannelTypeDictList(params) {
  return request({
    url: '/basic/system/basicMessage/getChannelTypeDictList',
    method: 'get',  // 蓝色背景GET方法
    params
  })
}

// 4. 获取模板类型字典 (GET /system/basicMessage/getMessageTypeDictCollect)
export function getMessageTypeDictCollect(params) {
  return request({
    url: '/basic/system/basicMessage/getMessageTypeDictList/v2',
    method: 'get',  // 蓝色背景GET方法
    params
  })
}

// 5. 新建消息 (POST /system/basicMessage)
export function createMessage(data) {
  return request({
    url: '/basic/system/basicMessage',
    method: 'post',  // 绿色背景POST方法
    data: data,
  })
}

// 6. 删除消息 (DELETE /system/basicMessage/{messageIds})
export function deleteMessage(messageIds) {
  return request({
    url: `/basic/system/basicMessage/${messageIds}`,
    method: 'delete',  // 红色背景DELETE方法
  })
}

// 获取供应商（消息）类型下拉列表
export function getSupplierTypeDictList() {
  return request({
    url: '/basic/system/basicSupplierInfo/getSupplierTypeDictList',
    method: 'get',
  })
}